<html>
<head>
<meta charset="iso-8859-1">
<style>
body,td,th{font-family:sans-serif}
a.sort_link{margin-left:10px;text-decoration:none}
</style>

<script src="../brython_builtins.js"></script>
<script src="../py2js.js"></script>
<script src="../py_utils.js"></script>
<script src="../py_classes.js"></script>
<script src="../py_list.js"></script>
<script src="../py_string.js"></script>
<script src="../py_dom.js"></script>
<script src="../py_ajax.js"></script>
<script src="../py_import.js"></script>

</head>
<body onLoad="brython(1)">

        <script type="text/python">
        from html import *
        items = ['unan','daou','tri','pevar','pemp']
        
        def swap(src,dest):
            selected = src.selectedIndex
            if selected == -1:
                return
            option = src.options[selected]
            del src.options[selected]
            dest.options.append(option)
            option.selected = False
        
        def up(src):
            selected = int(src.selectedIndex)
            if selected == -1 or selected == 0:
                return
            option = src.options[selected]
            del src.options[selected]
            src.options.insert(selected-1,option)
        
        def down(src):
            selected = int(src.selectedIndex)
            if selected == -1 or selected == len(src.options)-1:
                return
            options = src.options
            option = options[selected]
            del src.options[selected]
            src.options.insert(selected+1,option)
        
        t = TABLE()
        tb = TBODY()
        
        up_down_left = BUTTON('\u2191',onClick="up(left)")
        up_down_left += BR()+BUTTON('\u2193',onClick="down(left)")
        
        left = SELECT(size=10,style={'width':100})
        
        for i,_item in enumerate(items):
            option = OPTION(_item,value=i,width=40,Id='opt%s' %i,selected=i==1)
            left <= option
        
        buttons = BUTTON('>',onClick="swap(left,right)")
        buttons += BR()+BUTTON('<',onClick="swap(right,left)")
        
        right = SELECT(size=10,style={'width':100})
        
        up_down_right = BUTTON('\u2191',onClick="up(right)")
        up_down_right += BR()+BUTTON('\u2193',onClick="down(right)")
        
        tb <= TR(TD(up_down_left)+TD(left)+TD(buttons)+TD(right)+TD(up_down_right))
        t <= tb
        doc <= t
        
        </script>

</body>
</html>